<?php
/**
 * Control content for static portion of site
 *  
 * author: Chris Lunsford
 **/
class ContentModel extends Model {
	
	function __construct() {
		parent::__construct();
	}
	
	function createBIYL($post) {
		$this->db->insert('cms_biyl', $post);
	}
	
	function deleteBIYL($id) {
		$this->db->where('id', $id);
		$this->db->delete('cms_biyl');
	}
	
	function updateBIYL($id, $post) {
		$this->db->where('id', $id);
		$this->db->update('cms_biyl', $post);
	}
	
	function getBIYL($id) {
		$this->db->where('id', $id);
		return $this->db->get('cms_biyl')->row();
	}
	
	function getBIYLs() {
		return $this->db->get('cms_biyl');
	}
	
	function createPodcast($post) {
		$this->db->insert('cms_podcasts', $post);
	}
	
	function deletePodcast($id) {
		$this->db->where('id', $id);
		$this->db->delete('cms_podcasts');
	}
	
	function updatePodcast($id, $post) {
		$this->db->where('id', $id);
		$this->db->update('cms_podcasts', $post);
	}
	
	function getPodcast($id) {
		$this->db->where('id', $id);
		return $this->db->get('cms_podcasts')->row();
	}
	
	function getPodcasts() {
		return $this->db->get('cms_podcasts');
	}
	
	function createAnnouncement($post) {
		$this->db->insert('cms_announcements', $post);
	}
	
	function deleteAnnouncement($id) {
		$this->db->where('id', $id);
		$this->db->delete('cms_announcements');
	}
	
	function updateAnnouncement($id, $post) {
		$this->db->where('id', $id);
		$this->db->update('cms_announcements', $post);
	}
	
	function getAnnouncement($id) {
		$this->db->where('id', $id);
		return $this->db->get('cms_announcements')->row();
	}
	
	function getAnnouncements() {
		return $this->db->get('cms_announcements');
	}
	
	function getCurrentAnnouncements() {
		$this->db->where('expires >', time());
		$this->db->orwhere('expires', 'IS NULL');
		return $this->db->get('cms_announcements');
	}
		
}
?>